{include file="public/_meta" /}
<link href="__PUBLIC_ADMIN__css/login.css" rel="stylesheet">
<script>
    if (window.top !== window.self) {
        window.top.location = window.location;
    }
</script>
</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">

                    <!-- <strong>还没有账号？ <a href="#">立即注册&raquo;</a></strong> -->
                </div>
            </div>
            <div class="col-sm-5">
                <form id="form">
                    <h4 class="no-margins">登录</h4>
                    <!-- <p class="m-t-md">登录到</p> -->
                    <input type="text" name="account" id="account" class="form-control uname" placeholder="账号" required="" />
                    <input type="password" name="pwd" id="pwd" class="form-control pword m-b" placeholder="密码" required=""/>
                    <!-- <a href="">忘记密码了？</a> -->
                    <a class="btn btn-success btn-block" id="login">登录</a>
                </form>
            </div>
        </div>
    </div>
{include file="public/_footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

	$(document).ready(function () {
		
		$("#login").click(function(){
			
			var account = $("#account").val();
			var pwd = $("#pwd").val();

			if (account == '' || pwd == '') {
				layer.alert('', {
				  	icon: 2,
				  	content: '账号或密码不能为空',
				  	skin: 'layer-ext-moon'
				})
				
				return false;
			}
			
			
			console.log($('#form').serialize());
		
			$.ajax({
				cache: false,
                type: "POST",
                url: '{:url("admin/idiom/login")}',
                data:$('#form').serialize(),	// 你的formid
                async: false,
                error: function(request) {
                    alert("Connection error");
                },
                success: function(data) {
                    if (data.errcode == 1) {
                        layer.alert('', {
                            icon: 2,
                            content: data.info,
                            skin: 'layer-ext-moon'
                        })
                        return false;
                        window.location.href = '{:url("admin/idiom/login")}'; 
                    }else{
                        window.location.href = '{:url("admin/idiom/index")}';
                    }
					             
                }
			})
		})
		
	});
</script>
</body>
</html>